// toast提示
if( $('#J_Toast_tips').length ){

}else{
  let oDiv = document.createElement('div');
  oDiv.id = 'J_Toast_tips';
  document.body.appendChild(oDiv);
}

// Layer-Mask
if( $('#J_LayerMask').length ){

}else{
  let oDiv = document.createElement('div');
  oDiv.id = 'J_LayerMask';
  oDiv.className = 'modal-backdrop fade in';
  document.body.appendChild(oDiv);
}

module.exports = function(msg, fn, time){
  time = time || 3;
  // show = show || true;
  fn = fn || function(){};
  clearTimeout($('#J_Toast_tips')[0].timer);
  msg = ''+msg;

  $('#J_Toast_tips').html(msg);
  $('#J_Toast_tips').show(200);
  $('#J_LayerMask').show();
  $('#J_Toast_tips')[0].timer = setTimeout( ()=>{
    $('#J_Toast_tips').hide(300, function(){
      $('#J_LayerMask').hide();
      fn();
    });

  }, time * 1000 );
};
